package com.coincalf.exchange.service;

import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.Cached;
import com.baomidou.mybatisplus.service.IService;
import com.coincalf.exchange.entity.Market;
import com.coincalf.framework.constants.Constant;
import com.coincalf.framework.enums.MarketType;
import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 交易对配置信息 服务类
 * </p>
 *
 * @author qiang
 * @since 2018-05-12
 */
public interface MarketService extends IService<Market>, Constant {

    /**
     * 根据交易市场类型查询（缓存2分钟）
     * @param marketType 交易区域类型
     * @return
     */
    @Cached(name=CACHE_KEY_MARKETS, expire = 120, cacheType = CacheType.LOCAL)
    List<Market> queryMarketListFromCache(MarketType marketType);

    /**
     * 基础货币兑（USDT或BTC）汇率
     * @param market 交易对
     * @return
     */
    BigDecimal getBaseCoinToPriceCoinRate(Market market);

    /**
     * 报价货币兑（USDT或BTC）汇率
     * @param market 交易对
     * @return
     */
    BigDecimal getPriceCoinToBaseCoinRate(Market market);
}
